#include "TextLineGUI.h"

TextLineGUI::TextLineGUI()
{
	connect(this,SIGNAL(textChanged( const QString & )), this,SLOT(onChange( const QString & )));
}

void TextLineGUI::addEvent( const std::string & eventType, Callback callback ) {
	if( eventType == "change" ) {
		 this->c = change_.connect( callback );
	}
}

void TextLineGUI::onChange( const QString & ) {
	if( this->c.connected() ) {
		change_();
	}
}

std::string TextLineGUI::getValue()
{
	return text().toUtf8().constData();
}

void TextLineGUI::updateValue(std::vector< std::string> str)
{

}

void TextLineGUI::updateValue(std::string str)
{
	this->setText(QString::fromStdString(str));
}

void TextLineGUI::clearValue(){
	this->clear();
}
